package c2.cross.business.rank.core;

import c2.cross.business.base.CrossSubModule;
import c2.cross.business.rank.CrossRankModule;
import cate.game.rank.cross.CrossRankMessageModule;
import cate.game.rank.cross.CrossRankMsg;
import cate.game.rank.po.Rank;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

@Slf4j
public class CrossRankMsgModule extends CrossSubModule<CrossRankModule> {
    /**
     * 游戏服结算
     */
    public Map<Integer, Rank> sendGameCrossRankActivitySettle(int srvId, int configTid, Map<Integer, Rank> indexToRoleRank) {
        try {
            return useRpcSend().requestResponseGameTemplate(CrossRankMsg.GAME_SETTLE_ACT,
                    srvId,
                    CrossRankMessageModule.CrossRankSettle.of(srvId, configTid, indexToRoleRank),
                    HashMap.class);
        } catch (Exception e) {
            log.error("", e);
            return indexToRoleRank;
        }
    }
}
